import org.lwjgl.opengl.GL11;


public class VBOobject {
	protected int vao = -1;
	protected float vertexPositions[];
	protected short[] indices;
	protected boolean isSetup = false;
	protected String type ="";
	protected int mode;
	protected boolean safe = true;
	protected boolean render = false;
	
	public VBOobject(String Type){
			this.type = Type;
			if(Type.equals("pyramid")){constructPyr();} 
			else if(Type.equals("cube")){constructCube();}
			else{safe = false;}
	}

	private void constructCube() {
		vertexPositions = new float[]{
				 //   x      y      z     	r      g     b     a
				// back quad
		         1.0f,  1.0f,  1.0f, 	1.0f, 0.0f, 0.0f, 1.0f, //0
		        -1.0f,  1.0f,  1.0f, 	1.0f, 0.0f, 0.0f, 0.1f,
		        -1.0f, -1.0f,  1.0f, 	1.0f, 0.0f, 0.0f, 0.1f,
		         1.0f, -1.0f,  1.0f, 	1.0f, 0.0f, 0.0f, 1.0f,
		    // front quad
		         1.0f,  1.0f, -1.0f, 	0.0f, 1.0f, 0.0f, 1.0f,
		        -1.0f,  1.0f, -1.0f, 	0.0f, 1.0f, 0.0f, 1.0f,
		        -1.0f, -1.0f, -1.0f, 	0.0f, 1.0f, 0.0f, 1.0f,
		         1.0f, -1.0f, -1.0f,	0.0f, 1.0f, 0.0f, 1.0f, //7
		   //diamonds
		        -1.0f,  0.5f, -0.5f, 	0.0f, 0.0f, 1.0f, 1.0f,
			    -1.0f, -0.5f,  0.5f, 	0.0f, 0.0f, 1.0f, 1.0f,
		         1.0f,  0.5f,  0.5f, 	0.5f, 0.0f, 1.0f, 1.0f,
		         1.0f, -0.5f, -0.5f, 	0.5f, 0.0f, 1.0f, 1.0f,
		};	
		indices = new short[]{	0, 1, 2, 3,
								4, 5, 6, 7,
								0, 1, 5, 4,
								2, 3, 7, 6,
								1, 8, 6, 9,
								3, 10, 4, 11
		};
		mode = GL11.GL_QUADS;
	}

	private void constructPyr() {
		vertexPositions = new float[]{
				 //   x      y      z     	r      g     b     a
			         0.0f,  0.0f, -2.0f, 	1.0f, 0.0f, 0.0f, 1.0f,
			         1.0f,  0.0f, -2.0f, 	0.0f, 1.0f, 0.0f, 1.0f,
			         0.5f,  1.0f, -2.0f, 	0.0f, 0.0f, 1.0f, 1.0f,
			         0.5f,  0.0f, -1.0f, 	1.0f, 0.0f, 1.0f, 1.0f,
		};	
		indices = new short[]{	0,1,2,
								0,3,1,
								0,3,2,
								1,2,3
		};
		mode = GL11.GL_TRIANGLES;
	}

	public int getVao() {
		return vao;
	}
	public int getMode() {
		return mode;
	}
	public void setVbo(int vao) {
		this.vao = vao;
		System.out.println("This Is the RenderObject for: "+ type+" , my VAO is SET to : "+this.vao);
	}
	public short[] getIndices() {
		return indices;
	}
	public float[] getVertexPositions() {
		return vertexPositions;
	}
	public boolean isSetup() {
		return isSetup;
	}
	public String getType() {
		return type;
	}
	public boolean isSafe() {
		return safe;
	}
	public boolean getRender() {
		return render;
	}

	public void setRender(boolean state) {
		this.render = state;
	}
}
